<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8"/>
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-touch-fullscreen" content="yes">
    <title>delegate example</title>
    <script src="/kissy/build/seed-debug.js" charset="utf-8"></script>
    <script src="/kissy/src/package.js"></script>
    <style type="text/css">
        body, html {
            margin: 0;
            padding: 0;
        }
    </style>
</head>
<body>
<p>Click on disabled [button1], no click event should fire. However, live click event fires in IE.</p>

<div id="a" class="b">
    <div class="c">
        <input type="button" class='b' disabled='disabled' id="b1" value="button1">
        <input type="button" class='b' id="b2" value="button2">
    </div>
</div>
<script>
    var S = KISSY;

    if (1) {
        S.use("dom,event/dom", function (S, Dom, Event) {
            var t;
            Event.on("#b1", "click", function () {
                S.log("KISSY click on #b1");
            });
            Event.on("#b2", "click", function () {
                S.log("KISSY click on #b2");
            });
            Event.delegate("#a", "click", ".c", t = function (e) {
                S.log("KISSY delegate-click on #a .c");
                e.stopImmediatePropagation();
            });
            Event.delegate("#a", "click", ".b", function (e) {
                S.log("KISSY delegate-click on #a .b");
            });
            Event.on("#a", "click", function (e) {
                S.log("KISSY click on #a");
            });
            // Event.undelegate("#a", "click");
            // Dom.get("#b1").click();
        });
    }

    if (0) {
        var $ = jQuery;
        $("#b1").on("click", function () {
            S.log("click on #b1");
        });
        $("#b2").on("click", function () {
            S.log("click on #b2");
        });

        $("#a").on("click", ".c", function (e) {
            S.log("delegate-click on #a .c");
            e.stopImmediatePropagation();
        });

        $("#a").on("click", ":button", function (e) {
            S.log("delegate-click on #a :button");
        });

        $("#a").on("click", ".b", function () {
            S.log("delegate-click on #a .b");
        });

        $("#a").trigger("click");
    }

</script>
</body>
</html>